<?php
	
	class Conexao{
		
		private $host = "local";
		private $user = "root";
		private $password = "123";
		private $port = "3306";
		private $con = NULL;
		private $dbname = "testw";
		
		public function open(){
			
			$this->con = new PDO("mysql:host=".$this->host.";port=".$this->port.";dbname=".$this->dbname."",$this->user,$this->password,array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
			
			return $this->con;
		}
		
		public function close(){
			
			$this->con = NULL;
		}
		
		public function checkStatus(){
			
			if(!$this->con){
				
				echo "<h3> O sistema não está conectado a [$this->dbname] em [$this->host]</h3>";
			}
			else{
				echo "<h3> O sistema está conectado a [$this->dbname] em [$this->host]</h3>";
			}
		}
	}
?>